package com.bdqn.t350.ch04mybatisplus.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.bdqn.t350.ch04mybatisplus.mapper.UserMapper;
import com.bdqn.t350.ch04mybatisplus.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class UserServiceImp implements UserService {


    @Resource
    UserMapper userMapper;


    @Override
    public List<User> getList() {
        return userMapper.selectList(null);
    }

    @Override
    public IPage<User> getPageList(IPage iPage) {
        return userMapper.selectPage(iPage, null);
    }

    @Override
    public User getUser(String username, String pwd) {
        QueryWrapper<User> queryWrapper = new QueryWrapper();
        queryWrapper.eq("usr_name", username);
        queryWrapper.eq("usr_password", pwd);
        return userMapper.selectOne(queryWrapper);
    }
}
